home *** CD-ROM | disk | FTP | other *** search
/ The Original Shareware 1.1 / The Original Shareware (WeMake CDs)(Volume 1.1)(CDs, Inc)(1993).iso / 32 / jots.zip / MSGBOX.BAS < prev    next >
BASIC Source File  |  1989-03-13  |  1KB  |  48 lines

  1. ' MSGBOX.BAS -- This module takes care of the message box.  It allows
  2. ' temporarily saving messages on a message stack
  3. ' $INCLUDE: 'J.INC'
  4.  
  5. ' $DYNAMIC
  6. DIM SHARED MessageStack$(1)
  7. DIM SHARED StackPtr, Blank$
  8. DIM SHARED MyBox AS BoxType, TopRow, BotRow, LftCol, RtCol
  9.  
  10. SUB InitMessage
  11.     CALL BoxCoords(MessageBox, MyBox)
  12.     TopRow = MyBox.TopRow
  13.     BotRow = MyBox.BotRow
  14.     LftCol = MyBox.LftCol
  15.     RtCol = MyBox.RtCol
  16.     MaxLen = RtCol - LftCol - 1
  17.     Blank$ = STRING$(MaxLen, " ")
  18.     StackPtr = 1
  19.     REDIM MessageStack$(1 TO 10)
  20.     NormalBox (MessageBox)
  21. END SUB
  22.  
  23. SUB PushMsg
  24.     IF StackPtr <= 10 THEN
  25.         MessageStack$(StackPtr) = Blank$       'Last message printed
  26.         StackPtr = StackPtr + 1
  27.     END IF
  28. END SUB
  29.  
  30. SUB PopMsg
  31.     IF StackPtr > 1 THEN
  32.         StackPtr = StackPtr - 1
  33.     END IF
  34.     ShowMessage (MessageStack$(StackPtr))
  35. END SUB
  36.  
  37. SUB ShowMessage (Msg$)
  38.     Temp$ = Msg$
  39.     IF LEN(Temp$) < LEN(Blank$) THEN
  40.         Temp$ = STRING$((LEN(Blank$) - LEN(Temp$)) / 2, " ") + Temp$
  41.     END IF
  42.     LSET Blank$ = Temp$
  43.     COLOR Normal, Background, Background
  44.     LOCATE TopRow + 1, LftCol + 1, 0
  45.     PRINT Blank$;
  46. END SUB
  47.  
  48.